﻿<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
  
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Windows User Action Hook | EventHook </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Windows User Action Hook | EventHook ">
    <meta name="generator" content="docfx 2.35.0.0">
    
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="styles/docfx.vendor.css">
    <link rel="stylesheet" href="styles/docfx.css">
    <link rel="stylesheet" href="styles/main.css">
    <meta property="docfx:navrel" content="">
    <meta property="docfx:tocrel" content="">
    
    <meta property="docfx:rel" content="">
    
  </head>
  <body data-spy="scroll" data-target="#affix" data-offset="120">
    <div id="wrapper">
      <header>
        
        <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
          <div class="container">
            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              
              <a class="navbar-brand" href="index.html">
                <img id="logo" class="svg" src="logo.svg" alt="">
              </a>
            </div>
            <div class="collapse navbar-collapse" id="navbar">
              <form class="navbar-form navbar-right" role="search" id="search">
                <div class="form-group">
                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
                </div>
              </form>
            </div>
          </div>
        </nav>
        
        <div class="subnav navbar navbar-default">
          <div class="container hide-when-search" id="breadcrumb">
            <ul class="breadcrumb">
              <li></li>
            </ul>
          </div>
        </div>
      </header>
      <div class="container body-content">
        
        <div id="search-results">
          <div class="search-list"></div>
          <div class="sr-items">
            <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
          </div>
          <ul id="pagination"></ul>
        </div>
      </div>
      <div role="main" class="container body-content hide-when-search">
        <div class="article row grid">
          <div class="col-md-10">
            <article class="content wrap" id="_content" data-uid="">
<h2 id="windows-user-action-hook">Windows User Action Hook</h2>

<p>A one stop library for global windows user actions such mouse, keyboard, clipboard, &amp; print events</p>
<p><a href="https://ci.appveyor.com/project/justcoding121/windows-user-action-hook"><img src="https://ci.appveyor.com/api/projects/status/htea647ukrgg4qcl?svg=true" alt="Build Status"></a></p>
<p>Kindly report only issues/bugs here . For programming help or questions use <a href="http://stackoverflow.com/questions/tagged/windows-user-action-hook">StackOverflow</a> with the tag EventHook or Windows-User-Action-Hook.</p>
<ul>
<li><a href="http://justcoding121.github.io/Windows-User-Action-Hook/api/EventHook.html">API Documentation</a></li>
</ul>
<h2 id="supported-events">Supported Events</h2>
<ul>
<li>Keyboard events</li>
<li>Mouse events</li>
<li>clipboard events</li>
<li>application events</li>
<li>print events</li>
</ul>
<h2 id="usage">Usage</h2>
<p>Install by <a href="https://www.nuget.org/packages/EventHook">nuget</a></p>
<pre><code>Install-Package EventHook
</code></pre><h2 id="sample-code">Sample Code:</h2>
<pre><code class="lang-csharp">var eventHookFactory = new EventHookFactory();

var keyboardWatcher = eventHookFactory.GetKeyboardWatcher();
keyboardWatcher.Start();
keyboardWatcher.OnKeyInput += (s, e) =&gt;
{
    Console.WriteLine(string.Format(&quot;Key {0} event of key {1}&quot;, e.KeyData.EventType, e.KeyData.Keyname));
};

var mouseWatcher = eventHookFactory.GetMouseWatcher();
mouseWatcher.Start();
mouseWatcher.OnMouseInput += (s, e) =&gt;
{
    Console.WriteLine(string.Format(&quot;Mouse event {0} at point {1},{2}&quot;, e.Message.ToString(), e.Point.x, e.Point.y));
};

var clipboardWatcher = eventHookFactory.GetClipboardWatcher();
clipboardWatcher.Start();
clipboardWatcher.OnClipboardModified += (s, e) =&gt;
{
    Console.WriteLine(string.Format(&quot;Clipboard updated with data &#39;{0}&#39; of format {1}&quot;, e.Data, e.DataFormat.ToString()));
};


var applicationWatcher = eventHookFactory.GetApplicationWatcher();
applicationWatcher.Start();
applicationWatcher.OnApplicationWindowChange += (s, e) =&gt;
{
    Console.WriteLine(string.Format(&quot;Application window of &#39;{0}&#39; with the title &#39;{1}&#39; was {2}&quot;, e.ApplicationData.AppName, e.ApplicationData.AppTitle, e.Event));
};

var printWatcher = eventHookFactory.GetPrintWatcher();
printWatcher.Start();
printWatcher.OnPrintEvent += (s, e) =&gt;
{
    Console.WriteLine(string.Format(&quot;Printer &#39;{0}&#39; currently printing {1} pages.&quot;, e.EventData.PrinterName, e.EventData.Pages));
};

//waiting here to keep this thread running           
Console.Read();

//stop watching
keyboardWatcher.Stop();
mouseWatcher.Stop();
clipboardWatcher.Stop();
applicationWatcher.Stop();
printWatcher.Stop();

//dispose
eventHookFactory.Dispose();
</code></pre><p><img src="https://raw.githubusercontent.com/justcoding121/Windows-User-Action-Hook/stable/EventHook.Examples/EventHook.ConsoleApp.Example/Capture.PNG" alt="alt tag"></p>
</article>
          </div>
          
          <div class="hidden-sm col-md-2" role="complementary">
            <div class="sideaffix">
              <div class="contribution">
                <ul class="nav">
                </ul>
              </div>
              <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
              <!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
              </nav>
            </div>
          </div>
        </div>
      </div>
      
      <footer>
        <div class="grad-bottom"></div>
        <div class="footer">
          <div class="container">
            <span class="pull-right">
              <a href="#top">Back to top</a>
            </span>
            
            <span>Generated by <strong>DocFX</strong></span>
          </div>
        </div>
      </footer>
    </div>
    
    <script type="text/javascript" src="styles/docfx.vendor.js"></script>
    <script type="text/javascript" src="styles/docfx.js"></script>
    <script type="text/javascript" src="styles/main.js"></script>
  </body>
</html>
